if select(2, UnitClass("player")) ~= "ROGUE" then return end

local f = CreateFrame("Frame", nil, UIParent)
f:ClearAllPoints()
f:SetWidth(16*5+8)
f:SetHeight(24)
f:SetPoint("CENTER")
f:SetBackdrop({
	bgFile = "Interface\\TutorialFrame\\TutorialFrameBackground",
	edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
	tile = true,
	edgeSize = 16,
	tileSize = 32,
	insets = {
		left = 5,
		right = 5,
		top = 5,
		bottom = 5
	}
})
f:EnableMouse(true)
f:SetMovable(true)
f:SetToplevel(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", function (f) f:StartMoving() end)
f:SetScript("OnDragStop", function (f) f:StopMovingOrSizing() end)

f.points = {}
for i = 1, 5 do
	local t = f:CreateTexture(nil, "ARTWORK")
	t:SetTexture("Interface\\ComboFrame\\ComboPoint")
	f.points[i] = t
	t:ClearAllPoints()
	t:SetWidth(12)
	t:SetHeight(16)
	t:SetTexCoord(0, 0.375, 0, 1)
	t:SetPoint("BOTTOMLEFT", i * 16 - 8, 0)
end

f:Show()

local events = {}

function events:PLAYER_COMBO_POINTS()
	local cb = GetComboPoints()
	for i = 1, 5 do
		if cb >= i then
			self.points[i]:Show()
		else
			self.points[i]:Hide()
		end
	end
end

events.TARGET_CHANGED = events.PLAYER_COMBO_POINTS

for event in pairs(events) do
	f:RegisterEvent(event)
end

f:SetScript("OnEvent", function (self, event, ...)
	local handler = events[event]
	if handler then
		handler(self, event, ...)
	end
end)

f:Show()
events.PLAYER_COMBO_POINTS(f)
